package middleware

import (
	"github.com/gin-gonic/gin"
	"sync/atomic"
	"uss-root/global"
)

func Counter() gin.HandlerFunc {
	return func(context *gin.Context) {
		atomic.AddInt64(&global.NetCount, 1)
		context.Next()
		atomic.AddInt64(&global.NetCount, -1)
	}
}
